#!/bin/bash

# Wrapper script around wget to save near downloaded files corresponded <name>.URL files with real urls from what it was obtained.

wget -c "$@" 2>&1 | tee >( echo "$@" > "$(grep -oP '(?<=[«‘]).+(?=[»’] (saved|сохранён))').URL" )